package chapter2.No2_2_synchronized同步语句块.p锁对象的改变.demo2;

/**
 * *：该实验说明修改引用类型的对象属性时，是不会影响同步线程！
 *
 */
public class Main {
    public static void main(String[] args) throws InterruptedException {
        ServiceClass sc = new ServiceClass();
        UserBean userBean = new UserBean();

        MyThread a = new MyThread(sc, userBean);
        userBean.setUserName("aa");
        userBean.setPsw("AA");
        a.setName("a");
        a.start();

        Thread.sleep(500);

        MyThread b = new MyThread(sc, userBean);
        userBean.setUserName("bb");
        userBean.setPsw("BB");
        b.setName("b");
        b.start();

    }
}
